package m202405.d17;

/**
 * @@author: 爱做梦的锤子
 * @date: 2024/5/17 16:23
 */
public class Q287 {
    public int findDuplicate(int[] nums) {
        int[] temp = new int[nums.length - 1];
        for (int num : nums) {
            if (temp[num - 1] != 0) {
                return num;
            }
            temp[num - 1] = num;
        }
        return -1;
    }
}
